<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>项目信息</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div>
        <div id="pageInTab" class="pageInTab">
            <div tabid="tabA" title="基本信息" id="tabAId" lselected="true">
                <form id="prj_bsc_info_form">
                    <div class="fieldset1 tabel_col clearFix">
                        <div class="caption">
                            <div class="btnsBox posR">
                                <sys:FlowFrmAth preTaskIds="${preTaskIds}" athCd="addPrjBscInfo" pInstId="${pInstId}">
                                    <span id="chooseCst" class="sq-button sq-button-round" onclick="chooseCstPage()">选择客户</span>
                                </sys:FlowFrmAth>
                            </div>
                            <span>&nbsp;</span>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">所属机构</div>
                            <div class="field">
                                <input name="orgCd" id="orgCd" type="text" class="ui-textbox" value="" placeholder="请选择"
                                       ltype="combobox">
                            </div>
                            <div style="display: none">
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">项目所属客户经理</div>
                            <div class="field">
                                <select name="cstMgrId" id="cstMgrId" onchange="changeSelectOrgCd();"
                                        validate="{required:true}">
                                    <option value="  " selected="selected">--请选择--</option>
                                    <c:forEach items="${actMgrList}" var="mgr">
                                        <option value="${mgr.id}" cstMgrOrgCd="${mgr.orgCd}" cstMgrNm="${mgr.refRlNm}"
                                        >${mgr.refRlNm}${mgr.usrNm}</option>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>

                        <!--业务类型  -->
                        <div class="fieldBox col_33">
                            <div class="label">业务模式</div>
                            <div class="field">
                                <select name="bizTypCd" id="bizTypCd" onchange="changeSelectSun();"
                                        validate="{required:true}">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${bizTypCdList}" var="opt">
                                        <option value="${opt.key}">${opt.value}</option>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <c:if test="${buOrgCd =='00000005'}">
                            <!-- 汽车金融 -->
                            <!-- 代理商类型 -->
                            <%--    <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormQCJR" cmpDtlCd="agntTypCd" orgCds="${orgCds }"></ui:normalSelect> --%>
                            <!-- 是否团单 --><!-- pgCd:页面代码  cmpCd:组件代码  cmpDtlCd:页面字段 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormQCJR"
                                             cmpDtlCd="isGrpBizForQCJR" orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 业务来源 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormQCJR" cmpDtlCd="bizResCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 业务类型 -->
                            <%--  <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormQCJR" cmpDtlCd="subBizTypCd" orgCds="${orgCds }"></ui:normalSelect> --%>
                            <!-- 业务形式 -->
                            <%-- <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormQCJR" cmpDtlCd="bizModCd" orgCds="${orgCds }"></ui:normalSelect> --%>
                            <!-- 项目类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormQCJR" cmpDtlCd="prjTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>

                        </c:if>

                        <c:if test="${buOrgCd =='00000008'}">
                            <!-- 专车 -->
                            <!-- 项目类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZC" cmpDtlCd="prjTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 代理商类型 -->
                            <%-- <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZC" cmpDtlCd="agntTypCd" orgCds="${orgCds }"></ui:normalSelect>
                           <!-- 是否团单 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZC" cmpDtlCd="isGrpBiz" orgCds="${orgCds }"></ui:normalSelect> --%>
                            <!-- 业务来源 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZC" cmpDtlCd="bizResCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 采购类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZCDG" cmpDtlCd="buyType"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 租赁物用途 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZCKC"
                                             cmpDtlCd="prjIndCdZc" orgCds="${orgCds }"></ui:normalSelect>
                            <%--    <!-- 其他行业（租赁物用途）（专车） -->
                            <ui:normalInput pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZCKC" cmpDtlCd="prjOthIndCd" orgCds="${orgCds }"></ui:normalInput> --%>

                        </c:if>

                        <c:if test="${buOrgCd =='00000008'}">
                            <!-- 医疗 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormYL" cmpDtlCd="prjTypCd"
                                         orgCds="${orgCds }"></ui:normalSelect>
                        </c:if>

                        <c:if test="${buOrgCd =='00000013'}">
                            <!-- 新能源汽车 -->
                            <!-- 项目类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormXNY" cmpDtlCd="prjTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 业务来源 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormXNY" cmpDtlCd="bizResCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 租赁物用途 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormXNY"
                                             cmpDtlCd="prjIndCdXny" orgCds="${orgCds }"></ui:normalSelect>
                        </c:if>

                        <c:if test="${buOrgCd =='00000007'}">
                            <!--卡云 -->
                            <!-- 项目类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormKY" cmpDtlCd="prjTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 代理商类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormKY" cmpDtlCd="agntTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 是否团单 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormKY" cmpDtlCd="isGrpBiz"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 业务来源 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormKY" cmpDtlCd="bizResCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 租赁物用途 -->
                            <ui:normalInput pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormKY" cmpDtlCd="prjIndCd"
                                            orgCds="${orgCds }"></ui:normalInput>
                            <!-- 其他行业（租赁物用途）（重卡） -->
                            <ui:normalInput pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormKY" cmpDtlCd="prjOthIndCd"
                                            orgCds="${orgCds }"></ui:normalInput>
                        </c:if>

                        <c:if test="${buOrgCd =='00000001'}">
                            <!-- 重卡 -->
                            <!-- 项目类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZK" cmpDtlCd="prjTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 代理商类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZK" cmpDtlCd="agntTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 是否团单 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZK" cmpDtlCd="isGrpBiz"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 业务来源 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZK" cmpDtlCd="bizResCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 租赁物用途 -->
                           <%--  <ui:normalInput pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZK" cmpDtlCd="prjIndCd"
                                            orgCds="${orgCds }"></ui:normalInput> --%>
                            <!-- 其他行业（租赁物用途）（重卡） -->
                            <ui:normalInput pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormZK" cmpDtlCd="prjOthIndCd"
                                            orgCds="${orgCds }"></ui:normalInput>
                        </c:if>

                        <c:if test="${buOrgCd =='00000009'}">
                            <!-- 优车 -->
                            <!-- 项目类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormYC" cmpDtlCd="prjTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 代理商类型 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormYC" cmpDtlCd="agntTypCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 是否团单 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormYC" cmpDtlCd="isGrpBiz"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 业务来源 -->
                            <ui:normalSelect pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormYC" cmpDtlCd="bizResCd"
                                             orgCds="${orgCds }"></ui:normalSelect>
                            <!-- 租赁物用途 -->
                            <ui:normalInput pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormYC" cmpDtlCd="prjIndCd"
                                            orgCds="${orgCds }"></ui:normalInput>
                            <!-- 其他行业（租赁物用途）（重卡） -->
                            <ui:normalInput pgCd="prjBscInfoAddPage" cmpCd="prjBscInfoAddPageFormYC" cmpDtlCd="prjOthIndCd"
                                            orgCds="${orgCds }"></ui:normalInput>
                        </c:if>

                        <div class="fieldBox col_33">
                            <div class="label">合同签署方式</div>
                            <div class="field">
                                <select name="cntTypCd" id="cntTypCd" validate="{required:true}">
                                    <option value="  " selected="selected">--请选择--</option>
                                    <c:forEach items="${cntTypCdList}" var="cnt">
                                        <option value="${cnt.key}">${cnt.value}</option>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" id="isHaveUpStructDiv" style="display: none">
                            <div class="label">是否含上装贷</div>
                            <div class="field">
                                <select name="isHaveUpStruct" id="isHaveUpStruct">
                                    <option value="  " selected="selected">--请选择--</option>
                                    <c:forEach items="${yesNoList}" var="keyValue">
                                        <option value="${keyValue.key}">${keyValue.value}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_33" id="cstNmDiv" style="display: none">
                            <div class="label">客户名称</div>
                            <div class="field">
                                <a href="javascript:showCstDetail()" class="link">
                                    <span name="cstNm" id="cstNm">&nbsp;</span>
                                </a>
                            </div>
                        </div>
                        <div class="fieldBox col_33" id="cstMarStsDiv">
                            <div class="label">客户婚姻状态</div>
                            <div class="field">
                                <span name="cstMarStsNm" id="cstMarStsNm">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" style="display: none" id="cstRlNmDiv">
                            <div class="label">客户配偶名称</div>
                            <div class="field">
                                <span name="cstRlNm" id="cstRlNm">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_66" id="rlCstRiskDiv" style="display: none">
                            <div class="label">配偶征信：</div>
                            <div class="field">
                                <span style="color: red;" id="rlCstRisk"></span>
                            </div>
                        </div>

                        <div class="fieldBox col_33" id="fundRasInsNmDiv" style="display: none">
                            <div class="label">机构名称</div>
                            <div class="field">
                                <!-- <a href="javascript:showCstDetail()" class="link"> -->
                                <span name="fundRasInsNm" id="fundRasInsNm"></span>
                                <!-- </a> -->
                            </div>
                        </div>

                        <div class="fieldBox col_33" id="bkNoDiv" style="display: none">
                            <div class="label">开户银行</div>
                            <div class="field">
                                <input name="bkNo" id="bkNo" data-value="${bkNo}" placeholder="请选择" ltype="combobox" validate="">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" id="accNoDiv" style="display: none">
                            <div class="label">银行账号</div>
                            <div class="field">
                                <input name="accNo" id="accNo" type="text" class="ui-textbox" value="${accNo}" validate="{number:true, maxlength:22, minlength:15}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" id="mpDiv" style="display: none">
                            <div class="label">预留手机号</div>
                            <div class="field">
                                <input name="mp" id="mp" type="text" class="ui-textbox" value="${mp}" validate="{number:true, maxlength:11, minlength:11}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>

			 			  <div class="fieldBox col_33" id="accNoWSDiv"  style="display: none">
	                            <div class="label">支付宝账号</div>
	                            <div class="field">
	                                <input name="wsAccNo" id="wsAccNo" type="text" class="ui-textbox" value="${wsAccNo}" >
	                                <span class="requiredSymbol">*</span>
	                            </div>
	                        </div>
	                        <c:if test="${buOrgCd =='00000001'}">
				                 <div class="fieldBox col_33">
								<div class="label">主货物大类</div>
								<div class="field">
									<select name="mainGdsTypCd" id="mainGdsTypCd" data-value=" "  validate="{required:true}" onchange="getTripGoodsSubCd();">
										<option value=" " checked >请选择</option>
										<c:forEach items="${mainGdsTypCdList }" var="kv">
										       <option value="${kv.key }">${kv.value }</option>
										</c:forEach>

									</select>
									 <span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">主运输货物</div>
								<div class="field">
									<select name="goods" id="goods" data-value=" " validate="{required:true}">
									</select>
									<span class="requiredSymbol">*</span>
								</div>
							</div>
	                        </c:if>
                        <div class="fieldBox col_100_auto" style="width:66.6%">
                            <div class="label">区域</div>
                            <div class="field">
                                <jsp:include page="../../system/sysRegion/region.jsp" flush="true">
                                    <jsp:param name="regionShowLvl"  value="2"/>
                                </jsp:include>
                            </div>
                        </div>
                        <c:if test="${prjTypCd == 'CDDYW'}">
                        <div class="fieldBox col_100_auto" style="width:66.6%">
                            <div class="label">车抵贷预约编号</div>
                            <div class="field">
                                <a style="cursor: pointer;" onclick="odrDetail()" class="link">
                                    <span>${odrNo}</span>
                                </a>
                            </div>
                         </div>
                        </c:if>
                         <!--  -------------------tsn------------------------------------ -->
                      <c:if test="${buOrgCd == '00000008' }">
	      		     <div class="fieldBox col_100_auto"  id="pledgeDiv"  >
	      			<div class="label">是否需要抵押</div>
	      			<div class="field">
	      			<select name="pledge" id="pledge" validate="{required:true}">
	      				 <option value="0" selected="selected">请选择</option>
                   		 <c:forEach items="${kvList}" var="pledge">
                   		 <c:choose>
                   		 	<c:when test="${pledge.key ==pledgeCd}">
                   		 	<option value="${pledge.key}" selected="selected">${pledge.value}</option>
                   		 	</c:when>
                   		 <c:otherwise>
                   		 	<option value="${pledge.key}">${pledge.value}</option>
                   		 </c:otherwise>
                   		 </c:choose>
                      </c:forEach>
	      			</select>
	      			<span class="requiredSymbol">*</span>
	      			</div>
	      		</div>
	      		</c:if>

	      		 <!--  -------------------tsn------------------------------------ -->
                        <div class="fieldBox col_100_auto" id="noticeDiv" style="display: none">
                            <div class="label">注意事项：</div>
                            <div class="field">
                                <span style="color: red;">请务必核查收款方信息！！！</span>
                            </div>
                        </div>

                        <!-- 征信信息 -->
                        <div class="fieldBox col_100" style="width:100%">
                            <div class="caption">
                                <span class="title">客户征信</span>
                            </div>
                            <div class="sqPanel">
                                <div id="detailGrid">
                                    <div id="ligergrid_rsk" class="sq-grid"></div>
                                </div>
                            </div>
                        </div>
                        <!-- 征信信息 -->
                        <div class="fieldBox col_100" style="width:100%; display: none" id="rlCstRskDiv">
                            <div class="sqPanel">
                                <div class="sqPanel_head inL">
                                    <span class="title" id="rlCstRskTitle">配偶征信</span>
                                </div>
                                <div class="sqPanel_body">
                                    <div id="ligergrid_rlCst_rsk" class="sq-grid"></div>
                                </div>
                            </div>
                        </div>
                        <!-- 浙商征信 -->
                        <div class="fieldset1 tabel_col clearFix" id="zsBankGridDIV" style="display: none">
				            <div class="caption">
		                        <span class="title">浙商银行征信</span>
		                    </div>
		                    <div class="fieldBox col_100_auto">
								<div id="ligergrid_zsBank" class="sq-grid"></div>
							</div>
						</div>


                        <input type="hidden" id="cstId" name="cstId" class="ui-textbox" value="${cstId}">
                        <input type="hidden" id="addPrjPage" name="addPrjPage" class="ui-textbox" value="1">
                        <input type="hidden" id="fundRasInsId" name="fundRasInsId" class="ui-textbox" value="">
                        <input type="hidden" id="insCode" name="insCode" class="ui-textbox" value="">
                        <input type="hidden" id="certNo" class="ui-textbox" value="${certNo}">
                        <input type="hidden" id="certTypCd" class="ui-textbox" value="${certTypCd}">
                        <input type="hidden" id="certValidSDt" class="ui-textbox" value="${certValidSDt}">
                        <input type="hidden" id="certValidEDt" class="ui-textbox" value="${certValidEDt}">
                        <input type="hidden" id="cstTypCd" class="ui-textbox" value="${cstTypCd}">
                        <input type="hidden" id="fqtype" class="ui-textbox" value="">
                    </div>
                    <!-- hide data -->
                    <div class="fieldBox col_100" style="display:none;">
                        <div class="field">
                            <input name="prjId" id="prjId" type="hidden" class="ui-textbox" value="${id}">
                            <input name="cstMgrOrgCd" id="cstMgrOrgCd" type="hidden" class="ui-textbox"
                                   value="${cstMgrOrgCd}">
                        </div>
                    </div>
                    <div class="btnsBox">
                        <%--<sys:FlowFrmAth preTaskIds="${preTaskIds}" athCd="addPrjBscInfo" pInstId="${pInstId}">
                            <span id="savePrjBscInfoBtn" class="sq-button sq-button-round" onclick="savePrjBscInfo()"><!-- <i class="sqBtnIco_10"></i> -->保存</span>
                            <span id="cancelBtn" class="sq-button sq-button-round" onclick="cancelBtn()"><!-- <i class="sqBtnIco_14"></i> -->取消</span>
                        </sys:FlowFrmAth>--%>
                        <span id="savePrjBscInfo_Btn" class="sq-button sq-button-round l-dialog-btn-ok">保存</span>
                        <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
                        <span id="savePrjBscInfo_cancelBtn" class="sq-button sq-button-round" onclick="cancelBtn()">取消</span>
                    </div>
                </form>
            </div>
            <div tabid="tabC" title="资信信息" id="tabCId" style="display: none;" prjId="" cstId="">
                <iframe frameborder="0" name="tabC" id="tabC" src="" prjId="" cstId=""></iframe>
            </div>

            <div tabid="tabH" title="项目产品" id="tabHId" style="display: none;" prjId="" cstId="">
                <iframe frameborder="0" name="tabH" id="tabH" src="" prjId="" cstId=""></iframe>
            </div>

            <!--   <div tabid="tabD" title="担保人资信信息" id="tabDId" style="display: none;" prjId="" cstId="">
             	 <iframe frameborder="0" name="tabD" id="tabD" src="" prjId="" cstId=""></iframe>
             </div> -->
            <div tabid="tabM" title="${sysInsTabCfgVO!=null?sysInsTabCfgVO.title:''}" id="tabMId" style="display: none;">
                <iframe frameborder="0" name="tabM" id="tabM" src=""></iframe>
            </div>
        </div>
        <!-- 流程使用开始 -->
        <input name="preTaskIdsNm" id="preTaskIds" type="text" style="display: none;" value="${preTaskIds}"/>
        <input name="pInstIdNm" id="pInstId" type="text" style="display: none;" value="${pInstId}"/>
        <!-- 流程使用结束-->
    </div>
</div>

<script type="text/javascript">
    var pageInApp = {
        flag: true
    };
    var _isInitPage_flag = false;
    var prjId = '${id}';
    var bizModCd = '${bizModCd}';
    var prjTypCd = '${prjTypCd}';
    var cstMgrId = "";
    var selectOrgCd = "";
    var searchOrgTree = null;
    var firstNode = null;
    var currOrgId = '${currOrgId}';
    var textName = '${orgTextName}';//节点名称
    var orgData = null;
    var id = "";//初始值
    var detailFlag = '${detailFlag}';
    var isFlow = '${isFlow}';
    var ywParam = '${ywParam}';
    var buOrgCd = '${buOrgCd}';
    var showTabs = '${showTabs}';
    var currOrg = '${currOrg}';
    var beforeCstId = null; //之前的客户id
    var beforePrjTypCd = null;//之前的项目类型
    var isChkFlag = null;
    var mainData;
    var rtnMsg="1";
    $("#pledgeDiv").hide();
    if(buOrgCd == "00000008"){//只有专车事业部显示是否需要抵押字段
   	 $("#pledgeDiv").show();
    }else{
    	 $("#pledge").attr("validate", "");
    }

    $(function () {
        initTab();
        var prjTypCd = $("#prjTypCd").val();
        var cstId = $("#cstId").val();
        /* if(prjTypCd&&cstId){
         queryCstCreditiInvest();
         } */

        $("#prjTypCd").change(function () {
            var prjTypCdVal = $(this).val();
            var cstId = $("#cstId").val();
            if (prjTypCdVal == "CDDYW") {
                $.ligerDialog.SQalert({content: "暂不支持新增车抵贷业务.", SQ_type: "warning"});
                return;
            }

            //第三方项目转普通项目时提示语
            if (prjId != "" ( prjTypCd == "DSFZGCT" || prjTypCd == "DSFZGCP" ) ) {
              	/* prompt(); */
          		$.ligerDialog.confirm("变更项目类型会删除所对应的报价方案和支付表信息，确定要变更吗？", function (flag) {
        			if(flag == false) {
        				setPrjTypCd();
        			}
        			else {
        				changePrjTypCd(prjTypCdVal);
        			}
            	});
            }
	        else {
				changePrjTypCd(prjTypCdVal);
	        }
            
        });
        $("#cstNm").change(function () {
            queryCstCreditiInvest();
        });
        if(buOrgCd == "00000008"){
            liger.get("pledge").setDisabled(true);
            $("#rgnProvCd").change(function () {
                var rgnProvCd=getRgnProvCd();
                if('0014'==rgnProvCd){
                	var selectid= $("#pledge").ligerGetComboBoxManager();
                	$("#pledge").val("2");
                	selectid.setValue($("#pledge").val());
                	selectid.setText($("#pledge").find(":selected").text());
                }else if (""==rgnProvCd){
                	var selectid= $("#pledge").ligerGetComboBoxManager();
                	$("#pledge").val("0");
                	selectid.setValue($("#pledge").val());
                	selectid.setText($("#pledge").find(":selected").text());
                }else{
                	var selectid= $("#pledge").ligerGetComboBoxManager();
                	$("#pledge").val("1");
                	selectid.setValue($("#pledge").val());
                	selectid.setText($("#pledge").find(":selected").text());
                }
            });
        }


        /*保存*/
        $("#savePrjBscInfo_Btn").click(function (event) {
            var form = liger.get("prj_bsc_info_form");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var data = form.getData();
            $.ligerDialog.hide();
            var _url = '<%=path%>/project/prjbscinfo/modifyprjBscInfoSystem.do?id='+prjId;
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: _url,
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        parent.$("#clearBtn").click();
                        parent.$("#searchBtn").click();
                        //frameElement.dialog.close();

                        //$("#resetBtn").click();
                        //回调刷新列表
                        //var callback=frameElement.W2W.callback;
                        //Remove_navTab();
                        //callback();
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });

    });

    function changePrjTypCd( prjTypCdVal ) {
        //普通项目转第三方项目提示语
        if (prjTypCdVal == "DSFZGCT" || prjTypCdVal == "DSFZGCP") {
            chooseFundPage();
        } else {
            $("#fundRasInsNmDiv").hide();
            $("#fundRasInsNm").html("");
            $("#fundRasInsId").val("");
            $("#insCode").val("");
            if(${sysInsTabCfgVO != null && sysInsTabCfgVO.isVisible != 0}) { pageInTab.removeTabItem("tabM"); }
        	$("#wsAccNo").attr("validate", "");
       	    $("#accNoWSDiv").hide();
        }

        if (prjTypCdVal && cstId) {
            queryCstCreditiInvest();
        }
        if (buOrgCd == ProjectConstant.CODE_BU_ORG_CD_ZK && prjTypCdVal == "DSFZGCP") {
            $("#isHaveUpStructDiv").show();
        } else {
            $("#isHaveUpStructDiv").hide();
        }
    }

    var localTabs = ["tabA", "tabB", "tabC", "tabE", "tabF", "tabG", "tabK", "tabL", "tabM","tabN"]

    function initData() {
        initPrjIndTree();
        initOrgTree();
        //初始化银行列表
        $("#bkNo").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            autocomplete: function (e) {
                filter_autoComboboxData(e.key, this);
                e.show();
            },
        });
        $("#prj_bsc_info_form").ligerForm({
            validate: true
        });
        var ligerForm = liger.get("prj_bsc_info_form");
        liger.get("bkNo").setData(${bankList});
        liger.get("bkNo").updateStyle();
        $("#prj_bsc_info_form").check_ligerFormEditor();
        var fromPrjFlag = '${fromPrjFlag}';
        if (fromPrjFlag && fromPrjFlag == 'true') {
            if (!isFlow || "0" == isFlow) {
                $("#chooseCstDiv").show();
            } else {
                $("#chooseCstDiv").hide();
            }
        } else {
            var cstNm = '${cstNm}';
            $("#cstNm").html(cstNm);
            $("#cstNmDiv").show();
            $("#chooseCstDiv").hide();
        }
        /*  // 设置业务种类默认为禁用
         var slt=liger.get("loanTypCd");
         slt.setDisabled();
         */
        if (prjId) {
            setPrjbscInfoData();//设置选择项目的值
        } else {
            //添加时设置树为选中状态
            var form = liger.get("prj_bsc_info_form");
            var currOrg = '${currOrg}';
            var mgrFlag = '${mgrFlag}';
            var cstMgrId = "";
            if (mgrFlag == "true") {
                cstMgrId = '${cstMgrId}';
            }
            form.setData({
                orgCd: currOrg,
                cstMgrId: cstMgrId
            });
        }
        if ("1" == isFlow) {
            $("#chooseCst").hide();
            /* if (liger.get("prjTypCd")) {
                liger.get("prjTypCd").setDisabled(true);
            } */
        }
        if (detailFlag == "true") {
            $("#savePrjBscInfoBtn").hide();
            $("#cancelBtn").hide();
            //详情 设置选项为不可选
            //$("#prjNm").attr("readonly","readonly");
            $("#chooseCstDiv").hide();
            $("#chooseCst").hide();
            liger.get("orgCd").setDisabled(true);
            liger.get("cstMgrId").setDisabled(true);
            /* 	liger.get("dsCd").setDisabled(true); */
            /* 	liger.get("loanTypCd").setDisabled(true); */
            if (liger.get("mainGdsTypCd")) {
                liger.get("mainGdsTypCd").setDisabled(true);
            }
            if (liger.get("goods")) {
                liger.get("goods").setDisabled(true);
            }
            if (liger.get("agntTypCd")) {
                liger.get("agntTypCd").setDisabled(true);
            }
            if (liger.get("bizModCd")) {
                liger.get("bizModCd").setDisabled(true);
            }
            if (liger.get("isGrpBiz")) {
                liger.get("isGrpBiz").setDisabled(true);
            }
            if (liger.get("bizResCd")) {
                liger.get("bizResCd").setDisabled(true);
            }
            if (liger.get("investTypCd")) {
                liger.get("investTypCd").setDisabled(true);
            }
            if (liger.get("insSol")) {
                liger.get("insSol").setDisabled(true);
            }
            if (liger.get("refereeTel")) {
                liger.get("refereeTel").setDisabled(true);
            }
            if (liger.get("purpose")) {
                liger.get("purpose").setDisabled(true);
            }
            if (liger.get("repayWay")) {
                liger.get("repayWay").setDisabled(true);
            }
            if (liger.get("guarMsr")) {
                liger.get("guarMsr").setDisabled(true);
            }
            if (liger.get("deductWayCd")) {
                liger.get("deductWayCd").setDisabled(true);
            }
            if ($("#othLsDesc")) {
                $("#othLsDesc").attr("readonly", "readonly");
            }
            if (liger.get("rgnProvCd")) {
                liger.get("rgnProvCd").setDisabled(true);
            }
            if (liger.get("rgnCityCd")) {
                liger.get("rgnCityCd").setDisabled(true);
            }
            if ($("#prjRem")) {
                $("#prjRem").attr("readonly", "readonly");
            }
            if (liger.get("rgnCityCd")) {
                liger.get("rgnCityCd").setDisabled(true);
            }
            if (liger.get("prjIndCd")) {
                liger.get("prjIndCd").setDisabled(true);
            }
            if (liger.get("prjOthIndCd")) {
                liger.get("prjOthIndCd").setDisabled(true);
            }
            if (liger.get("buyType")) {
                liger.get("buyType").setDisabled(true);
            }
            if (liger.get("prjIndCdZc")) {
                liger.get("prjIndCdZc").setDisabled(true);
            }
            if (liger.get("prjIndCdXny")) {
                liger.get("prjIndCdXny").setDisabled(true);
            }
            if (liger.get("isHaveUpStruct")) {
                liger.get("isHaveUpStruct").setDisabled(true);
            }
            liger.get("bkNo").setDisabled(true);
            liger.get("accNo").setDisabled(true);
            liger.get("mp").setDisabled(true);
            if(liger.get("wsAccNo")){
            liger.get("wsAccNo").setDisabled(true);
            }

        }
        changeSelectSun(0);
        var prjTypCd = $("#prjTypCd").val();
        if (buOrgCd == ProjectConstant.CODE_BU_ORG_CD_ZK && prjTypCd == "DSFZGCP") {
            $("#isHaveUpStructDiv").show();
        } else {
            $("#isHaveUpStructDiv").hide();
        }
        if ($("#insCode").val()==="czbank"){
            $("#bkNoDiv").show();
            $("#accNoDiv").show();
            $("#mpDiv").show();
        }
        if ($("#insCode").val()==="icbc"){
      	  $("#isHaveUpStructDiv").show();
        }
        if ($("#insCode").val()==="alipay"){
        	 $("#accNoWSDiv").attr("validate", "{required:true}");
            $("#accNoWSDiv").show();
        }else{
        	  var ligerForm = liger.get("prj_bsc_info_form");

        	  /*  ligerForm.setFieldValidate("wsAccNo", {
                   required: true,
                   input: false
               }); */
        	$("#wsAccNo").attr("validate", "");
        	 $("#accNoWSDiv").hide();
        }
        
        if ("1" == isFlow) {
	        if (liger.get("prjTypCd")) { 
		        var currPrjTypCd = $("#prjTypCd").val();
		        $("#prjTypCd option").each(function(){
		        	// 如果当前选择的是“第三方资管城配”或者是“城配业务”，那么只保留“第三方资管城配”和“城配业务”
		        	if("DSFZGCP" == currPrjTypCd || "CPYW" == currPrjTypCd) { 
		        		if("DSFZGCP" != $(this).val() && "CPYW" != $(this).val()) {
		        			$(this).remove();
		        		}
		        	}
		        	// 如果当前选择的是其他，那么移除“第三方资管城配”和“城配业务”
		        	else if( ("DSFZGCP" == $(this).val() || "CPYW" == $(this).val()) ) {
		        		$(this).remove();
		        	}
		        })
	        	liger.get("prjTypCd").setSelect(); 
	        }
        }
    }


    var pageInTab = null;
    var loadedTabs = []
    //获取当前组织机构及其父级节点名称
    function changeSelectOrgCd() {
        //选中了客户经理，设置客户经理的组织机构
        var mgrOrg = $("#cstMgrId").find("option:selected").attr("cstMgrOrgCd");
        //添加时设置树为选中状态
        var form = liger.get("prj_bsc_info_form");
        form.setData({
            orgCd: mgrOrg,
        });
    }

  //主货物大类change事件
    function getTripGoodsSubCd(){
    	var _PCode = $("#mainGdsTypCd").val();//获取主货物大类的value
    	if(!_PCode) return;
    	$.ajax({
    		type: 'post',
    		dataType:'json',
    		data:{PCode:_PCode},
    		/* 获取货品下拉框的数据 */
    		url: '<%=path%>/audit/audCreditInfo/getGoodsTypJSON.do',
    		success:function(msg){
    			if(msg.success == 1){
					var goodsRes = '${goodsRes}';
    				//主运输货物
    				var goods = $("#goods");
    				if(goods && goods.length){
    					$("#goods").empty();
    					$("#goods").append("<option value=''>请选择</option>");
    					if(msg.data != null){
                            $.each(msg.data,function(index,obj) {
                                var option ="";
                                if(goodsRes == obj.key){
                                    option = "<option selected='selected'  value='"+obj.key+"'>"+obj.value+"</option>";
                                }else{
                                    option = "<option value='"+obj.key+"'>"+obj.value+"</option>";
                                }
                                $(option).appendTo("#goods");
                                liger.get("goods").setSelect();

                            });
                            $("#goods").add_ligerFormEditor();
                        }
    				}
    				SetIframe_height();
    			}else{
    				top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
    			}
    		}
    	});
    }

    //第三方资管城配，第三方资管传统转换为传统项目时提示语
    /* function prompt() {
    	$.ligerDialog.confirm("变更项目类型会删除所对应的报价方案和支付表信息，确定要变更吗？", function (flag) {
			if(flag == false) {
				setPrjTypCd();
			}
    	});
    } */

    function changeSelectSun(mark) {
        var bizTypCd = $("#bizTypCd").val();
        /* if(bizTypCd == "5"){
         if($("#prjTypCd").val() != undefined){
         var form = liger.get("prj_bsc_info_form");
         form.setData({
         prjTypCd:"GHKD",
         });
         }
         } */
        if (buOrgCd == "00000005" || buOrgCd == "00000013") {
            if ($("#prjTypCd").val() != undefined) {
                $.ajax({
                    type: 'get',
                    dataType: 'json',
                    url: '<%=path%>/project/prjbscinfo/selectByBizTypTemp.do',
                    data: {
                        bizTypCd: bizTypCd
                    },
                    success: function (data) {
                        liger.get("prjTypCd").clearContent();
                        var newOptions = "";
                        if ($("#bizTypCd").val() != '5') {
                            var newOptions = '<option value="">请选择</option>';
                        }
                        if ($("#bizTypCd").val() != null && $("#bizTypCd").val() != "") {
                            var options = data.selectList;
                            if (options.length > 0) {
                                for (var i = 0; i < options.length; i++) {
                                    newOptions += '<option value="' + options[i].key + '">' + options[i].value + '</option>';
                                }
                            }
                        }
                        $("#prjTypCd").html($(newOptions));
                        liger.get("prjTypCd").setSelect();
                        if (mark == 0) {
                            setPrjTypCd();
                        }
                    },
                    error: function (data) {

                    }
                });
            }
        }
        if ($("#bizModCd").val() != undefined) {
            $.ajax({
                type: 'get',
                dataType: 'json',
                url: '<%=path%>/project/prjbscinfo/selectByBizTyp.do',
                data: {
                    bizTypCd: bizTypCd,
                    prjId: prjId
                },
                success: function (data) {
                    liger.get("bizModCd").clearContent();
                    var newOptions = '<option value=" ">请选择</option>';
                    if ($("#bizTypCd").val() != null && $("#bizTypCd").val() != "") {
                        var options = data.brCdSelectList;
                        if (options.length > 0) {
                            for (var i = 0; i < options.length; i++) {
                                newOptions += '<option value="' + options[i].key + '">' + options[i].value + '</option>';
                            }
                        }
                    }
                    $("#bizModCd").html($(newOptions));
                    liger.get("bizModCd").setSelect();
                    if (mark == 0) {
                        setBizModCd();
                    }
                },
                error: function (data) {

                }
            });
            /* var form = liger.get("prj_bsc_info_form");
             form.setData({
             bizModCd:'
            ${bizModCd}',
             }); */
        }
    }

    function setBizModCd() {
        var form = liger.get("prj_bsc_info_form");
        form.setData({
            bizModCd: bizModCd,
        });
    }

    function setPrjTypCd() {
        var form = liger.get("prj_bsc_info_form");
        form.setData({
            prjTypCd: prjTypCd,
        });
    }

    function initOrgTree() {
        var params = {};
        if (detailFlag == "true" || prjId) {
            params.cstMgrOrgCd = $("#cstMgrOrgCd").val();
        }
        searchOrgTree = $("#orgCd").ligerComboBox({
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            //限制只能选叶节点，父节点不能点击
            treeLeafOnly: false,
            valueField: 'orgCd',
            textField: 'orgDispNm',
            showTreePath: true,
            tree: {
                ajaxType: 'get',
                idFieldName: 'orgCd',
                textFieldName: 'orgDispNm',
                checkbox: false,
                parentIcon: "none",
                childIcon: "none",
                needCancel: false
            },
            onSelected: function () {
                if (searchOrgTree.treeManager.getSelected()) {
                    var orgCd = searchOrgTree.treeManager.getSelected().data['orgCd'];
                    if (orgCd) {
                        //设置所属客户经理信息
                        setActManager(orgCd, cstMgrId)
                    }
                }
            }
        });
        $.ajax({
            type: 'get',
            dataType: 'json',
            data: params,
            url: '<%=path%>/project/prjbscinfo/searchOrgTree.do',
            success: function (msg) {
                if (msg.success == 1) {
                    searchOrgTree.treeManager.setData(msg.data);
                    searchOrgTree.clear();
                    searchOrgTree.setValue('${currOrg}');
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });

    }
    var searchPrjIndTree = null;
    //租赁物用途
    function initPrjIndTree() {
        var params = {};
        var prjIndCdObj = $("#prjIndCd");//租赁物用途
        if (prjIndCdObj.length) {
            searchPrjIndTree = $("#prjIndCd").ligerComboBox({
                selectBoxWidth: 240,
                selectBoxHeight: 150,
                //限制只能选叶节点，父节点不能点击
                treeLeafOnly: false,
                valueField: 'key',
                textField: 'value',
                showTreePath: true,
                tree: {
                    ajaxType: 'get',
                    idFieldName: 'key',
                    textFieldName: 'value',
                    checkbox: false,
                    parentIcon: "none",
                    childIcon: "none",
                    needCancel: false,
                    isExpand: false,
                }
            });
            $.ajax({
                type: 'get',
                dataType: 'json',
                data: params,
                url: '<%=path%>/project/prjbscinfo/searchPrjIndTree.do',
                success: function (msg) {
                    if (msg.success == 1) {
                        if (searchPrjIndTree) {
                            searchPrjIndTree.treeManager.setData(msg.data);
                            searchPrjIndTree.clear();
                        }
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });

        }

    }


    //根据所选的组织机构设置客户经理信息
    function setActManager(orgCd, cstMgrId) {
        var params = {};
        params.orgCd = orgCd;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: params,
            url: '<%=path%>/project/prjbscinfo/getCstMgrListByOrgId.do',
            success: function (msg) {
                if (msg.success == 1) {
                    setActManagerSelect(msg.data, cstMgrId);
                }
                /* else{
                 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
                 } */
            }
        });
    }
    //查找项目信息通过ID
    function setPrjbscInfoData() {
        var params = {};
        params.id = $("#prjId").val();
        $.ajax({
            type: 'get',
            dataType: 'json',
            async: false,
            data: params,
            url: '<%=path%>/project/prjbscinfo/getById.do',
            success: function (msg) {
                if (msg.success == 1) {
                    setPrjBscInfoData(msg.data);
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }
    function setPrjBscInfoData(prjbscInfo) {
    	//alert(prjbscInfo.goodsRes);
        if (prjbscInfo) {
            var form = liger.get("prj_bsc_info_form");
            form.setData({
                //prjNm:prjbscInfo.prjNm,
                cstNm: prjbscInfo.cstNm,
                cstId: prjbscInfo.cstId,
                /* fundRasInsNm:prjbscInfo.fundRasInsNm,
                 fundRasInsId:prjbscInfo.fundRasInsId, */
                orgCd: prjbscInfo.cstMgrOrgCd,
                cstMgrId: prjbscInfo.cstMgrId,
                /* 	dsCd:prjbscInfo.dsCd, */
                prjTypCd: prjbscInfo.prjTypCd,
                bizTypCd: prjbscInfo.bizTypCd,
                agntTypCd: prjbscInfo.agntTypCd,
                isGrpBiz: prjbscInfo.isGrpBiz,
                bizResCd: prjbscInfo.bizResCd,
                investTypCd: prjbscInfo.investTypCd,
                deductWayCd: prjbscInfo.deductWayCd,
                insSol: prjbscInfo.insSol,
                refereeTel: prjbscInfo.refereeTel,
                purpose: prjbscInfo.purpose,
                repayWay: prjbscInfo.repayWay,
                guarMsr: prjbscInfo.guarMsr,
                othLsDesc: prjbscInfo.othLsDesc,
                prjRem: prjbscInfo.prjRem,
                rgnProvCd: prjbscInfo.rgnPrCd,
                rgnCityCd: prjbscInfo.rgnCyCd,
                prjIndCd: prjbscInfo.prjIndCd,
                prjOthIndCd: prjbscInfo.prjOthIndCd,
                cstMgrId: prjbscInfo.cstMgrId,
                cntTypCd: prjbscInfo.cntTypCd,
                /* subBizTypCd:prjbscInfo.subBizTypCd, */
                bizModCd: prjbscInfo.bizModCd,
                buyType: prjbscInfo.buyType,
                prjIndCdZc: prjbscInfo.prjIndCd,
                prjIndCdXny: prjbscInfo.prjIndCd,
                isHaveUpStruct: prjbscInfo.isHaveUpStruct,
                mainGdsTypCd:prjbscInfo.mainGdsTypCd,//回显的货物大类

            });
            beforeCstId = prjbscInfo.cstId;
            beforePrjTypCd = prjbscInfo.prjTypCd;
            cstMgrId = prjbscInfo.cstMgrId;
            selectOrgCd = prjbscInfo.buOrgCd;
            // --> 设置初始值移到ligerForm之后 ！！！
            $("#orgCd").ligerGetComboBoxManager().updateStyle(); //设置值之后，需要刷新组件，才有变化
            $("#cstNm").html(prjbscInfo.cstNm);
            $("#cstId").val(prjbscInfo.cstId);
            $("#cstMgrOrgCd").val(prjbscInfo.cstMgrOrgCd);
            $("#cstNmDiv").show();

            if (prjbscInfo.prjTypCd == "DSFZGCT" || prjbscInfo.prjTypCd == "DSFZGCP") {
                $("#fundRasInsNm").html(prjbscInfo.fundRasInsNm);
                $("#fundRasInsId").val(prjbscInfo.fundRasInsId);
                $("#insCode").val(prjbscInfo.insCode);
                $("#fundRasInsNmDiv").show();
            }
            //设置省、市
            setRgnProvCdUpdataValue(prjbscInfo.rgnPrCd);
            setRgnCityCdUpdataValue(prjbscInfo.rgnCyCd);
            //setActManager(selectOrgCd,cstMgrId);
            pageInApp.flag = false;
        }
        queryCstCreditiInvest();
        getTripGoodsSubCd();
    }

    //设置所属客户经理选项
    function setActManagerSelect(data, cstMgrId) {
        liger.get("cstMgrId").setValue("  ");
        $("#cstMgrId").empty();
        liger.get("cstMgrId").clear();
        if (data) {
            var html = "";
            for (var i = 0; i < data.length; i++) {
                if (cstMgrId == data[i].id) {
                    html += "<option value='" + data[i].id + "'  cstMgrOrgCd='" + data[i].orgCd + "' cstMgrNm='" + data[i].refRlNm + "'  selected='selected'>" + data[i].refRlNm + data[i].usrNm + "</option>";
                } else {
                    html += "<option value='" + data[i].id + "'  cstMgrOrgCd='" + data[i].orgCd + "' cstMgrNm='" + data[i].refRlNm + "'>" + data[i].refRlNm + data[i].usrNm + "</option>";
                }
            }
            $(html).appendTo('#cstMgrId');
            liger.get("cstMgrId").setSelect();
        }
    }
    //初始化Tab
    function initTab() {
        if (showTabs != "" && showTabs != null) {
            var tabs = showTabs.split(",");
            $("#" + localTabs[0] + "Id").attr("lselected", false);
            $("#" + tabs[0] + "Id").attr("lselected", true);
        }
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            onBeforeSelectTabItem: function (tabid) {
                if (tabid != "tabA") {
                    if (pageInApp.flag) {
                        top.$.ligerDialog.SQalert({content: LogUtils.LOG_PRJ__PRD_SELECT_BEFORE, SQ_type: "warning"});
                        return false;
                    }
                    if(tabid == "tabN"){
                    	if (prjId == null || prjId == '') {
                            top.$.ligerDialog.SQalert({
                                content: "请先维护项目产品信息",
                                SQ_type: "warning"
                            });
                            return false; //验证不通过，不执行以下代码
                        }
                    	checkPrject(prjId);
                    	if(rtnMsg != "1"){
                   		 top.$.ligerDialog.SQalert({
                                content: rtnMsg,
                                SQ_type: "warning"
                            });
                            return false; //验证不通过，不执行以下代码
                   		}
                    }
                }
            },
            onAfterSelectTabItem: function (tabid) {
                //   if (loadedTabs.indexOf(tabid)<0) {
                if (tabid != "tabA") {
                    if (prjId == null || prjId == '') {
                        prjId = $("#prjId").val();
                        if (prjId == null || prjId == '') {
                            top.$.ligerDialog.SQalert({
                                content: LogUtils.LOG_PRJ__PRD_SELECT_BEFORE,
                                SQ_type: "warning"
                            });
                            return false; //验证不通过，不执行以下代码
                        }
                    }
                    
	                if(tabid == "tabN"){
                    	checkPrject(prjId);
                    	if(rtnMsg != "1"){
                   		 top.$.ligerDialog.SQalert({
                                content: rtnMsg,
                                SQ_type: "warning"
                            });
                            return false; //验证不通过，不执行以下代码
                   		}
                    }
                }
                loadedTabs.push(tabid);
                var url = "<%=path%>/project/prjbscinfo/toProjectSurveyPhotosList.do?prjId=" + prjId + "&&detailFlag=" + detailFlag;
                var pInstId = $("#pInstId").val();
                var preTaskIds = $("#preTaskIds").val();
                var flowParms = "&&pInstId=" + pInstId + "&&preTaskIds=" + preTaskIds;
                switch (tabid) {
                    case "tabB":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjPrdListPage.do?id=" + prjId + "&&detailFlag=" + detailFlag + flowParms);
                        break;
                    case "tabC":
                        if (detailFlag == "true") {
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjDetailInvestRptSystemPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + "&&cstRlCd=" + ProjectConstant.CST_RL_CST);
                        } else {
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjInvestAddPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + "&&cstRlCd=" + ProjectConstant.CST_RL_CST + flowParms);
                        }
                        $("#tabCId").attr("prjId", prjId);
                        $("#tabCId").attr("detailFlag", detailFlag);
                        $("#tabCId").attr("cstRlCd", ProjectConstant.CST_RL_CST);
                        break;
                    //  case "tabD":
                    // pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjcstbscInfo/toListPage.do?prjId="+prjId+"&&detailFlag="+detailFlag+"&&cstRlCd="+ProjectConstant.CST_RL_URGENT);
                    //   $("#tabDId").attr("prjId",prjId);
                    //  $("#tabDId").attr("detailFlag",detailFlag);
                    //  $("#tabDId").attr("cstRlCd",ProjectConstant.CST_RL_SPONSOR);
                    // break;

                    case "tabH":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjPrdListPage4Sys.do?id=" + prjId + "&&detailFlag=" + false + flowParms);
                        break;
                    case "tabE":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjquatprps/toListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + "&&isFlow=" + isFlow + flowParms);
                        break;
                    case "tabF":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjprddtl/toListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + flowParms);
                        break;
                    case "tabG":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjprddtl/toPrjPrdDtlListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + flowParms);
                        break;
                    case "tabK":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjFileInfo/toFileInfoListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + flowParms);
                        break;
                    case "tabL":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/cont/toListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + flowParms);
                        break;
                    case "tabM":
                    	pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjBscInfoInsDistribute/toPrjBscInsEditPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag );
                    	break;
                    case "tabN":
                    	pageInTab.setTabItemSrc(tabid, "<%=path%>/inscare/insapplication/toInsuranceTabPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag );
                    	break;
                }
                //     };
                SetIframe_height();
            }
        });


        if (showTabs != "" && showTabs != null) {
            var tabs = showTabs.split(",");
            tabid = tabs[0];
            switch (tabid) {
                case "tabA":
                    break;
                case "tabB":
                    pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjPrdListPage.do?id=" + prjId + "&&detailFlag=" + detailFlag);
                    break;
                case "tabC":
                    if (detailFlag == "true") {
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjDetailInvestRptSystemPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + "&&cstRlCd=" + ProjectConstant.CST_RL_CST);
                    } else {
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjInvestAddPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + "&&cstRlCd=" + ProjectConstant.CST_RL_CST);
                    }
                    $("#tabCId").attr("prjId", prjId);
                    $("#tabCId").attr("detailFlag", detailFlag);
                    $("#tabCId").attr("cstRlCd", ProjectConstant.CST_RL_CST);
                    break;
                //  case "tabD":
                // pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjcstbscInfo/toListPage.do?prjId="+prjId+"&&detailFlag="+detailFlag+"&&cstRlCd="+ProjectConstant.CST_RL_URGENT);
                //   $("#tabDId").attr("prjId",prjId);
                //  $("#tabDId").attr("detailFlag",detailFlag);
                //  $("#tabDId").attr("cstRlCd",ProjectConstant.CST_RL_SPONSOR);
                // break;
                case "tabE":
                    pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjquatprps/toListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag);
                    break;
                case "tabF":
                    pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjprddtl/toListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag);
                    break;
                case "tabG":
                    if (ywParam == "1") {
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjprddtl/toPrjPrdDtlListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag + "&&ywParam=" + ywParam + "&&buOrgCd=" + buOrgCd);
                    } else {
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjprddtl/toPrjPrdDtlListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag);
                    }
                    break;
                case "tabK":
                    pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjFileInfo/toFileInfoListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag);
                    break;
                case "tabL":
                    pageInTab.setTabItemSrc(tabid, "<%=path%>/project/cont/toListPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag);
                    break;
                case "tabM":
                	pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjBscInfoInsDistribute/toPrjBscInsEditPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag );
                	break;
                case "tabN":
                	pageInTab.setTabItemSrc(tabid, "<%=path%>/inscare/insapplication/toInsuranceTabPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag );
                	break;
            }
        }
        //pageInTab.removeTabItem("tabL");
        var isA = true;
        if (showTabs != "" && showTabs != null) {
            var tabs = showTabs.split(",");
            for (var i = 0; i < localTabs.length; i++) {
                for (var j = 0; j < tabs.length; j++) {
                    if (localTabs[i] == tabs[j]) {
                        if (tabs[j] == "tabA") {
                            isA = false;
                        }
                        break;
                    } else if (j == tabs.length - 1) {
                        pageInTab.removeTabItem(localTabs[i]);
                    }
                }
            }
        }
        if(${sysInsTabCfgVO == null || sysInsTabCfgVO.isVisible == 0}) {
        	pageInTab.removeTabItem("tabM");
        }

        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
        if (showTabs == "" || showTabs == null || isA == false) {
            initData();
        } else {
            pageInApp.flag = false;
        }
    };

    //保存项目基础信息
    function savePrjBscInfo() {
        var ligerForm = liger.get("prj_bsc_info_form");
        if (!ligerForm.valid()) {
            top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var data = ligerForm.getData();
        var prjTypCd = $("#prjTypCd").val();
        if($("#prjId").val()=="" && prjTypCd==="CDDYW"){
            top.$.ligerDialog.SQalert({content: "不支持创建车抵贷项目！", SQ_type: "error"});
            return false;
        }
        if (!prjTypCd && buOrgCd == "00000013") {
            top.$.ligerDialog.SQalert({content: "请选择项目类型！", SQ_type: "error"});
            return false;
        }
        if(!$("#cstId").val()){
            top.$.ligerDialog.SQalert({content: "请选择客户信息！", SQ_type: "error"});
            return false;
        }
        if ($("#prjTypCd").val() == "DSFZGCP" || $("#prjTypCd").val() == "DSFZGCT") {
            if ($("#fundRasInsId").val() == "") {
                top.$.ligerDialog.SQalert({content: "组织机构不能为空！", SQ_type: "error"});
                return false;
            }
            if ($("#insCode").val()==="czbank"){
                if($("#cstTypCd").val() == ProjectConstant.CST_TYP_CD_LP){
                    top.$.ligerDialog.SQalert({content: "暂不支持法人客户！", SQ_type: "error"});
                    return false;
                }
                if(!$("#certValidSDt").val()||!$("#certValidEDt").val()){
                    top.$.ligerDialog.SQalert({content: "请先维护客户证件的有效起止日期！", SQ_type: "error", SQ_showButtons:true});
                    return false;
                }
                if(!$("#bkNo").val()){
                    top.$.ligerDialog.SQalert({content: "开户银行不能为空！", SQ_type: "error"});
                    return false;
                }
                if(!$("#accNo").val()){
                    top.$.ligerDialog.SQalert({content: "银行账号不能为空！", SQ_type: "error"});
                    return false;
                }
                if(!$("#mp").val()){
                    top.$.ligerDialog.SQalert({content: "预留手机号不能为空！", SQ_type: "error"});
                    return false;
                }
                data["bkNo"] = liger.get("bkNo").selectedValue;
                data["bkNm"] = liger.get("bkNo").selectedText;
                data["accNo"] =  $("#accNo").val();
                data["mp"] = $("#mp").val();
                data["certNo"] = $("#certNo").val();
                data["certTypCd"] = $("#certTypCd").val();
            }

            if ($("#insCode").val()==="alipay"){
            	//网商
            	if(!$("#wsAccNo").val()){
                    top.$.ligerDialog.SQalert({content: "支付宝账号不能为空！", SQ_type: "error"});
                    return false;
                }
            	  data["accNo"] =  $("#wsAccNo").val();
            }
            if ($("#insCode").val()==="spdbank"){
            	//浦发
            	if(!$("#rgnProvCd").val()){
                    top.$.ligerDialog.SQalert({content: "区域-省不能为空！", SQ_type: "error"});
                    return false;
                }
            	if(!$("#rgnCityCd").val()){
                    top.$.ligerDialog.SQalert({content: "区域-市不能为空！", SQ_type: "error"});
                    return false;
                }
            }
        }
        if (!isChkFlag && isChkFlag == 0 && buOrgCd == "00000001" && insCode && insCode == ProjectConstant.PRJ_INS_CODE_ICBC) {
            top.$.ligerDialog.SQalert({content: "请查询配偶的征信信息！", SQ_type: "error"});
            return false;
        }
        /* 	var flag =  checkPrjNm();
         if(flag){
         return false; //验证不通过，不执行以下代码
         } */
        /*      	if(!getRgnProvCd()){
         top.$.ligerDialog.SQalert({content: "请选择所在省信息！",SQ_type: "warning"});
         return false;
         }
         if(!getRgnCityCd()){
         top.$.ligerDialog.SQalert({content: "请选择所在市信息！",SQ_type: "warning"});
         return false;
         } */
        //	var prjNm = $("#prjNm").val();
        var prjId = $("#prjId").val();
        //	  if(prjId){

        var selectedOptions = liger.get("cstMgrId").element.selectedOptions;
        var cstMgrOrgCd = $(selectedOptions).attr('cstMgrOrgCd');
        // var cstMgrNm =  $(selectedOptions).attr('cstMgrNm');
        var cstMgrNm = liger.get("cstMgrId").select.find('[selected="selected"]').attr('cstmgrnm');
        var cstMgrId = $("#cstMgrId").val();
        var orgCd = searchOrgTree.treeManager.getSelected().data['orgCd'];
        data["cstMgrOrgCd"] = orgCd;
        data["cstMgrNm"] = cstMgrNm;
        data["rgnPrCd"] = getRgnProvCd();
        data["rgnCyCd"] = getRgnCityCd();
        data["orgCd"] = orgCd;
        data["isFlow"] = isFlow;
        data["cstId"] = $("#cstId").val();
        data["cstNm"] = $("#cstNm").text();
        data["cstTypCd"] = $("#cstTypCd").val();
        data["fundRasInsId"] = $("#fundRasInsId").val();
        data["fundRasInsNm"] = $("#fundRasInsNm").text();
        data["insCode"] = $("#insCode").val();
        data["pledge"] = $("#pledge").val();//是否需要抵押
        data["mainGdsTypCd"] = $("#mainGdsTypCd").val();//主货物大类
        data["goods"] = $("#goods").val();//主运输货物
        var prjIndCdObj = $("#prjIndCd");//租赁物用途(重卡)
        var prjIndCdZcObj = $("#prjIndCdZc");//租赁物用途(专车)
        var prjIndCdXnyObj = $("#prjIndCdXny");//租赁物用途(新能源汽车)
        if (prjIndCdObj.length) {
            var prjIndCd = searchPrjIndTree.treeManager.getSelected().data['key'];
            data["prjIndCd"] = prjIndCd;
        }
        if (prjIndCdZcObj.length) {
            data["prjIndCd"] = $("#prjIndCdZc").val();
        }
        if (prjIndCdXnyObj.length) {
            data["prjIndCd"] = $("#prjIndCdXny").val();
        }

        var url = '<%=path%>/project/prjbscinfo/add.do';
        var prjId = $("#prjId").val();
        data["prjId"] = prjId;
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: data,
            url: url,
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    if (prjId && msg.data.isHaveQuat == 1) {
                        UIUtils.alertSuccessHold1("修改成功！修改项目类型会影响方案信息，请核查！");
                    } else {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    }
                    $("#prjId").val(msg.data.id);
                    pageInApp.flag = false;
                } else if (msg.success == 10000) {
                    UIUtils.alertSuccessHold1(msg.info);
                } else {
                    UIUtils.alertErrorHold1(msg.info);
                    //top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
                }
                if(!msg.data.sysInsTabCfgVO || msg.data.sysInsTabCfgVO.isVisible == 0) {
                	pageInTab.removeTabItem("tabM");
                }
                else {
                	if(pageInTab.isTabItemExist("tabM")) {
                    	pageInTab.setTabItemTitle('tabM', msg.data.sysInsTabCfgVO.title);
                	}
                	else {
                		pageInTab.addTabItem({
                    		text: msg.data.sysInsTabCfgVO.title,
                    		tabid: 'tabM',
                    		showClose: false,
                    		url: '<%=path%>/project/prjBscInfoInsDistribute/toPrjBscInsEditPage.do?prjId='+msg.data.id,
                    	});
                	}
                }
            }
        });

        <%-- 	  }else{
              var url = '<%=path%>/project/prjbscinfo/checkPrjNm.do';
           var params = {};
                 params.prjNm = prjNm;//项目名称
               $.ajax({
                   type: 'post',
                   dataType:'json',
                   data:params,
                   url: url,
                   success:function(msg){
                        if(msg.success == 1){
                            top.$.ligerDialog.SQalert({content: "该项目已经存在！",SQ_type: "error"});
                            return false;
                        }else{
                             var data = ligerForm.getData();
                               var selectedOptions=liger.get("cstMgrId").element.selectedOptions;
                               var cstMgrOrgCd =  $(selectedOptions).attr('cstMgrOrgCd');
                               var cstMgrNm =  $(selectedOptions).attr('cstMgrNm');
                               var cstMgrId = $("#cstMgrId").val();
                               var orgCd = searchOrgTree.treeManager.getSelected().data['orgCd'];
                               data["cstMgrOrgCd"] =orgCd;
                               data["cstMgrNm"] =cstMgrNm;
                               data["rgnPrCd"] =getRgnProvCd();
                               data["rgnCyCd"] =getRgnCityCd();
                               data["orgCd"] =orgCd;
                               data["cstId"] =$("#cstId").val();
                               data["cstNm"] =$("#cstNm").text();
                               var prjIndCdObj =$("#prjIndCd");//租赁物用途
                               if(prjIndCdObj.length){
                               var prjIndCd = searchPrjIndTree.treeManager.getSelected().data['key'];
                               data["prjIndCd"] =prjIndCd;
                               }
                               var url = '<%=path%>/project/prjbscinfo/add.do';
                               var prjId = $("#prjId").val();
                               data["prjId"]= prjId;
                               var wait_dialog;
                               $.ajax({
                                   type: 'post',
                                   dataType:'json',
                                   data:data,
                                   url: url,
                                   beforeSend: function(){
                                         wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
                                    },
                                   success:function(msg){
                                                wait_dialog.close();
                                        if(msg.success == 1){
                                                top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
                                            /*   var TAB=top.mainApp.parentTab;
                                                   var currentTabid=TAB.getSelectedTabItemID();
                                                   var currFrameElement=top.$("#"+currentTabid).get(0);
                                                    var callback=currFrameElement.W2W.callback;
                                                           callback();
                                                       top.tab.removeTabItem(currentTabid);  */
                                                      $("#prjId").val(msg.data);
                                                      pageInApp.flag=false;
                                        }else{
                                            top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
                                        }
                                   }
                               });
                        }
                   }
               });

              } --%>
    }
    //取消
    function cancelBtn() {
        var TAB = top.mainApp.parentTab;
        var currentTabid = TAB.getSelectedTabItemID();
        top.tab.removeTabItem(currentTabid);
    }
    //选择客户页面
    function chooseCstPage() {
        var cstRlFlag = ProjectConstant.CST_RL_CST;//客户
        var addPrjPage = "1";
        $.ligerDialog.open({
            title: '选择客户',
            height: 500,
            width: 850,
            url: '<%=path%>/project/prjbscinfo/toChoosePrjCstPage.do?id=' + prjId + '&&cstRlFlag=' + cstRlFlag + '&&addPrjPage=' + addPrjPage
        });
    }

    //选择机构页面
    function chooseFundPage() {
    	<%-- if (prjId != "" ) {//修改时提示确定修改后选择机构
    		$.ligerDialog.confirm("变更项目类型会删除所对应的报价方案和支付表信息，确定要变更吗？", function (flag) {
    			if(flag == false) {
    				setPrjTypCd();
    				return;
    			}
    	       $.ligerDialog.open({
    	           title: '选择机构',
    	           height: 500,
    	           width: 850,
    	           url: '<%=path%>/project/prjbscinfo/toChoosePrjFundPage.do?id=' + prjId
    	       });
        	});
    	}else {//添加时选择第三方项目后选择机构 --%>
    		$.ligerDialog.open({
 	           title: '选择机构',
 	           height: 500,
 	           width: 850,
 	           url: '<%=path%>/project/prjbscinfo/toChoosePrjFundPage.do?id=' + prjId
 	       });
    	<%-- } --%>
    }

    function showCstDetail() {
        var cstId = $("#cstId").val();
        Add_navTab('tab_cst_detail_page' + cstId, '客户详细信息', '<%=path%>/customer/cstbscinfo/toCustDetailPage.do?id=' + cstId);
    }

    function showFundDetail() {
        var fundRasInsId = $("#fundRasInsId").val();
        Add_navTab('tab_fund_detail_page' + fundRasInsId, '机构详细信息', '<%=path%>/project/prjbscinfo/toFundDetailPage.do?id=' + fundRasInsId);
    }
    // 检查项目名称是否重复
    function checkPrjNm() {
        var flag = false;
        var prjNm = $("#prjNm").val();
        var url = '<%=path%>/project/prjbscinfo/checkPrjNm.do';
        var params = {};
        params.prjNm = prjNm;//项目名称
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: params,
            url: url,
            success: function (msg) {
                if (msg.success == 1) {
                    top.$.ligerDialog.SQalert({content: "该项目已经存在！", SQ_type: "error"});
                    flag = true;
                }
            }
        });
        return flag;
    }
    //查询客户征信信息
    function queryCstCreditiInvest() {
        var prjTypCd = $("#prjTypCd").val();
        var cstId = $("#cstId").val();
        var prjId = $("#prjId").val();
        var orgCd = liger.get("orgCd").getValue();
        /*  if(searchOrgTree.treeManager.getSelected()){
         orgCd = searchOrgTree.treeManager.getSelected().data['orgCd'];
         } */
        var flag = false;
        var rskLvlCdNm = "";
        var audStsDescText = "";
        var audStsDesc3Text = "";
        var insCode = $("#insCode").val();
        if (insCode && insCode == ProjectConstant.PRJ_INS_CODE_ICBC) {
            $("#icbcAudDiv").show();
        }
        var url = '<%=path%>/project/prjbscinfo/queryCstCreditiInvest.do';
        var params = {};
        params.prjTypCd = prjTypCd; //项目类型
        params.cstId = cstId;
        params.prjId = prjId;
        params.cstMgrOrgCd = orgCd;
        params.insCode = insCode;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: params,
            url: url,
            success: function (msg) {
                if ((cstId != beforeCstId || prjTypCd != beforePrjTypCd) && (msg.success == 1)) {
                    flag = true;
                }
                /* 	 if(msg.success == 1){
                 rskLvlCdNm = msg.data.rskLvlCdNm;
                 audStsDescText = msg.data.audStsDesc;
                 audStsDesc3Text  = msg.data.audStsDesc3l;
                 if(!rskLvlCdNm){
                 rskLvlCdNm = "无";
                 }
                 if(!audStsDescText){
                 audStsDescText = "无";
                 }
                 if(!audStsDesc3Text){
                 audStsDesc3Text = "无";
                 }
                 }else{
                 rskLvlCdNm = "无";
                 audStsDescText = "无";
                 audStsDesc3Text = "无";
                 } */
                /*  $("#rskLvlCd").text(rskLvlCdNm);
                 $("#audStsDesc").html(audStsDescText);
                 $("#audStsDesc3").html(audStsDesc3Text); */

                /*       var rskData = {
                 "rows": [
                 {
                 "rskNm": "客户征信",
                 "rskLevel": rskLvlCdNm,
                 "rskDesc": audStsDescText
                 },
                 {
                 "rskNm": "工行征信",
                 "rskLevel":"无",
                 "rskDesc": audStsDesc3Text,
                 }
                 ],
                 "total": 2
                 } */
                if (flag) {
                    $("#noticeDiv").show();
                } else {
                    $("#noticeDiv").hide();
                }
                if (msg.success == 1) {
                    isChkFlag = msg.data.isChkFlag;
                    var rcCstBscInfoMap = {};
                    if (msg.data.rcCstBscInfoMap.rcCstBscInfoList) {
                        rcCstBscInfoMap.rows = msg.data.rcCstBscInfoMap.rcCstBscInfoList;
                        rcCstBscInfoMap.total = msg.data.rcCstBscInfoMap.rcCstBscInfoList.length;
                    } else {
                        rcCstBscInfoMap.rows = [];
                        rcCstBscInfoMap.total = 0;
                    }
                    cstLRskGrid(rcCstBscInfoMap);
                    if (msg.data.rcCstBscInfoMap.rlRcCstBscInfoList) {
                        var rlRcCstBscInfoMap = {};
                        if (msg.data.rcCstBscInfoMap.rlRcCstBscInfoList) {
                            rlRcCstBscInfoMap.rows = msg.data.rcCstBscInfoMap.rlRcCstBscInfoList;
                            rlRcCstBscInfoMap.total = msg.data.rcCstBscInfoMap.rlRcCstBscInfoList.length;
                        } else {
                            rlRcCstBscInfoMap.rows = [];
                            rlRcCstBscInfoMap.total = 0;
                        }

                        $("#cstMarStsNm").text(msg.data.marStsCdNm);
                        $("#cstRlNm").text(msg.data.rlNm);
                        $("#rlCstRskTitle").text("配偶（" + msg.data.rlNm + ")征信");
                        $("#cstRlNmDiv").show();
                        $("#cstMarStsDiv").show();
                        $("#rlCstRskDiv").show();
                        $("#rlCstRiskDiv").hide();
                        rlCstLRskGrid(rlRcCstBscInfoMap);
                    } else {
                        $("#cstRlNmDiv").hide();
                        $("#cstMarStsDiv").hide();
                        $("#cstMarStsNm").text(msg.data.marStsCdNm);
                        var rlRcCstBscInfoMap = {};
                        rlRcCstBscInfoMap.rows = [];
                        rlRcCstBscInfoMap.total = 0;
                        rlCstLRskGrid(rlRcCstBscInfoMap);
                        if (msg.data.rlResult) {
                            //$("#rlCstRskTitle").hide();
                            $("#rlCstRskDiv").hide();
                            $("#cstMarStsDiv").show();
                            $("#cstMarStsNm").text(msg.data.marStsCdNm);
                            $("#cstRlNm").text(msg.data.rlNm);
                            $("#cstRlNmDiv").show();
                            $("#rlCstRiskDiv").show();
                            $("#rlCstRisk").text(msg.data.rlResult);
                        }
                    }

                    //浙商征信结果
                    var zsBankResultList = {};
                    if (msg.data.rcCstResultMap && msg.data.rcCstResultMap.浙商银行) {
                    	zsBankResultList.rows = msg.data.rcCstResultMap.浙商银行;
                    	zsBankResultList.total = msg.data.rcCstResultMap.浙商银行.length;
                    	$("#zsBankGridDIV").show();
	                    zsBankGrid(zsBankResultList);
                    } else {
                    	$("#zsBankGridDIV").hide();
                    }

                }
                if (msg.success == 0) {
                    var data = {};
                    cstLRskGrid(data);
                    UIUtils.alertErrorHold1(msg.info);
                }
                /* 	       if(msg.success == 0){
                 if (_isInitPage_flag){
                 UIUtils.alertErrorHold1(msg.info);
                 }else {
                 _isInitPage_flag = true
                 }
                 }  */
            }
        });


    }

    function cstLRskGrid(data) {
        payAmtGrid = $("#ligergrid_rsk").ligerGrid({
            data: data,
            columns: [
                {display: '供应商名称', name: 'splNm', minWidth: 140},
                {display: '征信评级', name: 'rskLvlCdNm', minWidth: 140},
                {
                    display: '征信结果', name: 'audStsDesc', minWidth: 200, isEllipsis: false,
                    render: function (item) {
                        var audStsDesc3 = "";
                        var audStsDesc = "";
                        if (item.audStsDesc3) {
                            audStsDesc3 = item.audStsDesc3;
                        }
                        if (item.audStsDesc) {
                            audStsDesc = item.audStsDesc;
                        }
                        return audStsDesc3 + audStsDesc;
                    }
                }
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            heightDiff: -2,
            enabledEdit: false,
            isScroll: false,
            checkbox: false,
            rownumbers: true,
            fixedCellHeight: false,
            frozen: false,
            allowUnSelectRow: false,
            alternatingRow: false
        });
    }


    function rlCstLRskGrid(data) {
        payAmtGrid = $("#ligergrid_rlCst_rsk").ligerGrid({
            data: data,
            columns: [
                {display: '供应商名称', name: 'splNm', minWidth: 140},
                {display: '征信评级', name: 'rskLvlCdNm', minWidth: 140},
                {
                    display: '征信结果', name: 'audStsDesc', minWidth: 200, isEllipsis: false,
                    render: function (item) {
                        var audStsDesc3 = "";
                        var audStsDesc = "";
                        if (item.audStsDesc3) {
                            audStsDesc3 = item.audStsDesc3;
                        }
                        if (item.audStsDesc) {
                            audStsDesc = item.audStsDesc;
                        }
                        return audStsDesc3 + audStsDesc;
                    }
                }
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            heightDiff: -2,
            enabledEdit: false,
            isScroll: false,
            checkbox: false,
            rownumbers: true,
            fixedCellHeight: false,
            frozen: false,
            allowUnSelectRow: false,
            alternatingRow: false
        });
    }

    function zsBankGrid(data) {
        $("#ligergrid_zsBank").ligerGrid({
            data: data,
            columns: [
                {display: '供应商名称', name: 'splNm', minWidth: 140},
                {display: '征信评级', name: 'rskLvlCdNm', minWidth: 140},
                {display: '征信结果', name: 'audStsDesc', minWidth: 140},
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            heightDiff: -2,
            enabledEdit: false,
            isScroll: false,
            checkbox: false,
            rownumbers: true,
            fixedCellHeight: false,
            frozen: false,
            allowUnSelectRow: false,
            alternatingRow: false
        });
    }

    function odrDetail(){
        Add_navTab('tab_odrbscinfo_detail'+prjId,'预约详情','<%=path%>/carloan/odrbscinfo/toDetailPage.do?id='+prjId);
    }
    
    
    function checkPrject(prjId){
        $.ajax({
            url: '<%=path%>/inscare/insapplication/checkProject.do',
            type: 'get',
            async:false,
            data: {
            	prjId:prjId
            },
           
            dataType: "json",
            success: function (msg) {   //提交成功后自动执行的处理函数，参数data就是服务器返回的数据。
                if (msg.success == 1) {
                	rtnMsg="1";
                  return true;
                } else {
                    rtnMsg=msg.info;
                    return false;
                }
            },
            error: function (data, status, e) {
            	 rtnMsg=msg.info;
            	 return false;
            }
        });
    }
</script>

</body>
</html>